package com._54programer.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com._54programer.rabbit.RabbitDict;
import com._54programer.ws.SID;

@Configuration
public class RabbitConfig {

	@Autowired
	private SID SSID;
	
	@Bean
	public Queue queue() {
		return new Queue( SSID.ID(), true);
	}

	@Bean
	public FanoutExchange exchange() {
		return new FanoutExchange(RabbitDict.EXCHANGE_CLUSTER);
	}

	@Bean
	Binding binding() {
		return BindingBuilder.bind(queue()).to(exchange());
	}

}
